package cn.iutils.code.entity;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang3.StringUtils;

public class TreeNode {

	public TreeNode(String db,String tab) {
		dbName=db;
		tabName=tab;
	}
	/**
	 * 数据库名称
	 */
	public String dbName;
	/**
	 * 表名称
	 */
	public String tabName;

	/**
	 * 从字符串里面获取TreeNodes
	 * <p>Title: getNodeFromString</p>
	 * <p>Description: </p>
	 * @param str
	 * @return
	 */
	public static List<TreeNode> getNodeFromString(String str){
		ArrayList<TreeNode> list=new ArrayList<TreeNode>();
		String[] strNodes=str.split("\\|");
		for(String s:strNodes){
			if(!StringUtils.isEmpty(s))
			{
				String[] strNodeOne=s.split(",");
				list.add(new TreeNode(strNodeOne[0], strNodeOne[1]));
			}			
		}
		return list;
	}
}
